home *** CD-ROM | disk | FTP | other *** search
/ Compendium Deluxe 1 / LSD Compendium Deluxe 1.iso / a / programming / assembly / talinasm.lha / ptinrect.asm < prev    next >
Encoding:
Assembly Source File  |  1991-12-10  |  776 b   |  36 lines

  1. * ============================================================================ *
  2. *    PtInRect: Determines if a point is inside a rectangle
  3. *
  4. *    void PtInRect(struct IBox *b,SHORT x, SHORT y);
  5. *
  6. * ============================================================================ *
  7.  
  8.             include        'intuition/intuition.i'
  9.  
  10.             SECTION        ptinrect.asm,CODE
  11.  
  12.             xdef        _PtInRect
  13.  
  14. _PtInRect
  15. ; changed to use register calling parameters
  16. ;            move.l        4(sp),a1                ; IBox
  17. ;            movem.w        8(sp),d0-d1                ; x and y
  18.  
  19.             sub.w        ibox_Left(a1),d0        ; x - left
  20.             bmi.s        9$
  21.             cmp.w        ibox_Width(a1),d0        ; (x - left) > width
  22.             bpl.s        9$
  23.  
  24.             sub.w        ibox_Top(a1),d1            ; y - top
  25.             bmi.s        9$
  26.             cmp.w        ibox_Height(a1),d1        ; (y - top) > height
  27.             bpl.s        9$
  28.  
  29.             moveq        #-1,d0
  30.             rts
  31.  
  32. 9$            moveq        #0,d0
  33.             rts
  34.  
  35.             end
  36.